package com.thghh.docker.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计页面访问次数
 *
 * @author pengzhikang
 * @version 1.0
 * @date 2022/5/15 21:11
 */
@RestController
public class PageCountController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/pageCount")
    public String pageCount() {
        Long count = stringRedisTemplate.opsForValue().increment("page.count");
        return "有【" + count + "】个人访问这个页面.";
    }
}
